package com.dorje.sys.service.impl;


import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.dorje.sys.dao.RoleDao;
import com.dorje.sys.entity.Role;
import com.dorje.sys.service.RoleService;

@Service("roleService")
public class RoleServiceImpl extends BaseServiceImpl<Role> implements RoleService {
	
	@Autowired
	RoleDao roleDao;
	
	@Override
	public Set<String> findRoleByUser(Integer userId) {
		List<HashMap<String, String>> roles =  roleDao.findRoleByUser(userId);
		Set<String> set = new HashSet<String>();
		for(HashMap<String, String> r:roles){
			set.add(r.get("name"));
		}
		return set;
	}

	
}
